package com.suyujia.swagger_demo1.controller;

import com.suyujia.swagger_demo1.model.User;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
    @ApiResponses({
            @ApiResponse(code = 200, message = "请求成功"),
            @ApiResponse(code = 400, message = "请求参数没填好"),
            @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")
    })
    @GetMapping("/hello")
    public String hello(){
        return "hello mytest111,suyujia";
    }
    //只要我们的接口中的返回值中存在实体类，他就会扫描返回到swagger中
    @PostMapping("/user")
    public User user(){
        return new User();
    }
}
